from bfx.BfxAPI import *



def GetCoinNum(coinjson, ak, sk):
    bfc = BitfinexClient(ak, sk)
    coins = bfc.account_infos()
    #print(coins)
    #myCoins = coins['balances']
    for i in coins:
        num = (float)(i['amount'])
        if num > 0:
            if i['currency'] == 'qtm':
                if 'qtum' in coinjson.keys():
                    coinjson['qtum'] = coinjson['qtum'] + num
                else:
                    coinjson['qtum'] = num
            elif i['currency'] in coinjson.keys():
                coinjson[i['currency']] = coinjson[i['currency']] + num
            else:
                coinjson[i['currency']] = num

if __name__ == '__main__':
    GetCoinNum(json.loads('{}'), "5Vb42rsXrwh0XlSx7fYN0sps2OO311jAXB0aY19VG3p", "63qDq9o1it8tW1G2il9DqhB9ailGGSccLu4UYc9AzC4")